<?php 
namespace Home\Controller;
use Think\Controller;

class LoginController extends Controller{

	 public function login(){
	 	if(!IS_POST){
	 		$this->display();
	 	}else{
	 		$data=I();
	 		$model=M('member');
	 		$res=$model->where(['username'=>$data['user'],'password'=>md5($data['pwd'])])->find();
	 		if($res){
	 			cookie('username',$data['user']);
	 			$this->ajaxReturn(['code'=>10000,'msg'=>'登陆成功']); 
	 		}else{
	 			$this->ajaxReturn(['code'=>10001,'msg'=>'登陆失败']);
	 		}
	 	}
        
    }

   



}












 ?>